<template>
  <div class="app">
    <van-nav-bar
      :title="title"
      left-text="返回"
      left-arrow
      fixed
      @click-left="onClickLeft()"
    />
    <router-view></router-view>
    <van-tabbar v-model="active" class="navbot">
      <van-tabbar-item icon="home-o" to="/home"></van-tabbar-item>
      <van-tabbar-item icon="friends-o" to="/friends"></van-tabbar-item>
      <van-tabbar-item icon="cart-o" to="cart"></van-tabbar-item>
      <van-tabbar-item icon="search" to="search"></van-tabbar-item>
    </van-tabbar>
  </div>
</template>
<script>
export default {
  data: () => ({
    title: '首页',
    active: 0
  }),
  methods: {
    onClickLeft() {
      this.$router.go(-1)
    }
  },
  watch: {
    '$route.meta'(meta) {
      this.title = meta.title
    }
  }
}
</script>
<style lang="scss" scoped>
.app {
  padding-top: 46px;
  padding-bottom: 50px;
}
</style>
